package com.io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class TextIo {


	public static void main(String[] args) {
		InputStream input = null;
		byte[] a = new byte[10];
		try {
			input = new FileInputStream("e:/text1.txt");
			int read=0;;
			while ((read=input.read(a))>=0) {
				String string1 = new String(a,0,read);
				System.out.println(string1);
			}
			/*
			 * int read=0; while ((read=input.read())!=-1) {
			 * System.out.println(read); }
			 */
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				input.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

}
